package squareBorderPackage;

import static org.junit.Assert.*;

import java.math.BigDecimal;

import org.junit.*;

import temperaturePackage.*;

/**
 * A class collection tests for the class of open borders.
 * 
 * @version	1.0
 * @author 	Jessa Bekker & Esther Alberts
 */
public class OpenBorderTest {
	
	/**
	 * Instance variable referencing open borders that may change during individual
	 * tests.
	 */
	private OpenBorder open;
	
	/**
	 * Instance variable referencing squares that may change during individual
	 * tests.
	 */
	private Square defaultSquare1, defaultSquare2;
	
	@Before
	public void setUp() {
		defaultSquare1 = new NormalSquare();
		defaultSquare2 = new NormalSquare(new Temperature(45, TemperatureUnit.CELSIUS),new BigDecimal(45));
		open = new OpenBorder(defaultSquare1, Direction.SOUTH);
		open.attachTo(defaultSquare2, Direction.NORTH);
		
	}
	
	@Test
	public void getSlippery_LegalCase() {
		assertFalse(open.getSlippery());
	}
	@Test
	public void isObstacle_False() {
		assertFalse(open.isObstacle());
	}
	
	@Test
	public void getStrongestBorder_DoorNull() {
		assertTrue(open.getStrongestBorder(null)
		instanceof OpenBorder);
	}

	@Test
	public void getStrongestBorder_DoorOpenBorder() {
		assertTrue(open.getStrongestBorder(new OpenBorder(defaultSquare1, Direction.WEST))
		instanceof OpenBorder);
	}
	
	@Test
	public void getStrongestBorder_DoorDoor() {
		assertTrue(open.getStrongestBorder(new Door(true, defaultSquare1, Direction.EAST))
		instanceof Door);
	}
	
	@Test
	public void getStrongestBorder_DoorWall() {
		assertTrue(open.getStrongestBorder(new Wall(true, defaultSquare1, Direction.FLOOR))
		instanceof Wall);
	}
	
	@Test
	public void split_LegalCase() {
		OpenBorder[] newOpen = open.split();
		assertTrue(newOpen[0].getSquareAt(Direction.SOUTH) == defaultSquare1);
		assertTrue(newOpen[0].getSquareAt(Direction.NORTH) == null);
		assertTrue(newOpen[1].getSquareAt(Direction.NORTH) == defaultSquare2);
		assertTrue(newOpen[1].getSquareAt(Direction.SOUTH) == null);
	}
}
